#pragma once

#include "sys/IInterface.h"
#include "WorkspaceID.h"
#include "WsEvent.h"

interface IWorkspace;	interface IConnection; interface IView;

interface IDocument : public IInterface
{
	DEFINE_IID(IID_Document)

	event_declare(DocumentOpenEventHandler,Opening);
	event_declare(DocumentEventHandler,Opened);
	event_declare(DocumentCloseEventHandler,Closed);
	event_declare(DocumentCloseEventHandler,Closing);
	event_declare(DocumentCloseEventHandler,Saving);
	event_declare(DocumentCloseEventHandler,Saved);

	virtual const String& GetName() const = 0;
	virtual vresult Save(const String& name) = 0;
	virtual IWorkspace* GetWorkspace() const = 0;
	virtual bool  IsNew() const = 0;
	virtual IConnection* GetConnection() const = 0;
	virtual IObject* GetRoot() const  = 0;

	virtual void UpdateAllViews(IView* activeView) = 0;
};